//
//  YYETopicRecordTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2018/1/5.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYETopicRecordTableViewCell1.h"

@interface YYETopicRecordTableViewCell1 ()

@property (nonatomic,strong) UIImageView *headerIV;
@property (nonatomic,strong) UILabel *nameLabel;
@property (nonatomic,strong) UILabel *timeLabel;
@property (nonatomic,strong) UILabel *progressLabel;
@property (nonatomic,strong) UIButton *btn;
@property (nonatomic,strong) UIView *lineView;

@end

@implementation YYETopicRecordTableViewCell1

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //        self.contentView.backgroundColor = GeneralBackColor;
        
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.font = [UIFont systemFontOfSize:14];
        self.nameLabel.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.nameLabel];
        
        self.headerIV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.headerIV];
        [self.headerIV setImage:[UIImage imageNamed:@"shijian"]];

        
        self.timeLabel = [[UILabel alloc]init];
        self.timeLabel.textColor = LineColor;
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.timeLabel];
        
        self.progressLabel = [[UILabel alloc]init];
        self.progressLabel.textColor = LineColor;
        self.progressLabel.font = [UIFont systemFontOfSize:10];
        [self.contentView addSubview:self.progressLabel];
        
        
        self.lineView = [[UIView alloc]init];
        self.lineView.backgroundColor = LightLineColor;
        [self.contentView addSubview:self.lineView];
        
        self.nameLabel.text = @"英语轻松过四级小秘籍（一）";
        self.timeLabel.text = @"英语";
        self.progressLabel.text = @"03-04 14:20";
        
    }
    return self;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(19);
        make.top.equalTo(self.contentView.top).offset(24);
    }];
    

    
    [self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.left);
        make.top.equalTo(self.nameLabel.bottom).offset(18);
    }];
    
    [self.progressLabel makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.right).offset(-21);
        make.centerY.equalTo(self.nameLabel.centerY);
        
    }];
    
    [self.headerIV makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.progressLabel.left).offset(-5);
        make.centerY.equalTo(self.nameLabel.centerY);
        make.size.equalTo(CGSizeMake(13, 13));
    }];
    
    

    
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(15);
        make.right.equalTo(self.contentView.right).offset(-15);
        make.bottom.equalTo(self.contentView.bottom);
        make.height.equalTo(0.5);
    }];
    
}

// "process": 1, //进度(0未达到进度 1开始答题 2继续答题 3查看答题
// "type": 2, // 1是习题 2是考试
- (void)setModel:(YYEWrongRecordModel *)model
{
    _model = model;
    
    self.nameLabel.text = model.name;
    self.timeLabel.text = model.title;
    
    self.progressLabel.text = model.created_at;

    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end

